import { normalize, schema } from 'normalizr'

const labelE = new schema.Entity('labels')
const item = new schema.Entity('items', {
  label: [labelE],
})

export default (originalData) => {
  const result = normalize(originalData, item)
  if (result.entities.labels === undefined) {
    result.entities.labels = []
  }
  return result
}
